home *** CD-ROM | disk | FTP | other *** search
- Path: news.ld.centuryinter.net!usenet
- From: steidl@centuryineter.net
- Newsgroups: comp.lang.c++
- Subject: Re: Overloading operator [][] as in A[][]: possible?!
- Date: 14 Feb 1996 12:37:55 GMT
- Organization: Century Internet
- Message-ID: <4fsl33$maf@news.ld.centuryinter.net>
- References: <311F6E92.794BDF32@cenparmi.concordia.ca>
- Reply-To: steidl@centuryineter.net
- NNTP-Posting-Host: anx_p12.wi.centuryinter.net
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <311F6E92.794BDF32@cenparmi.concordia.ca>, Didier Guillevic <didier@cenparmi.concordia.ca> writes:
- >Bonjour,
- >
- >Learning C++ at the moment....
- >Any way to overload the indexing of a 2 dimensional array, as in
- >
- > A[i][j]
-
- It can be done using an intermediary class. For example, class A's operator[]
- returns a class B object. A class B object contains a reference to the class A
- object and the parameter passed in the first []. Class B's operator[] then
- gets the second parameter. It looks pretty (if you think C array notation is
- pretty) buts it's not very efficient (either code-size-wise or speed-wise).
-
-